/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tallerfinal.util.distributions;

import tallerfinal.util.distributions.factory.GeneratorsFactory;
import tallerfinal.util.enums.DistributionsName;

/**
 *
 * @author ricardo
 */
public class DiscreteUniformGenerator extends Generator<Integer> {

    static {
        GeneratorsFactory.getInstance().registerProduct(DistributionsName.UNIFORMEDISCRETA, DiscreteUniformGenerator.class);
    }
    private int range;
    private int minimumValue;
    
    public DiscreteUniformGenerator(int minimunValue, int maximumValue) {
        this.minimumValue = minimunValue;
        this.range = maximumValue - minimumValue + 1;
    }
    
    @Override
    public Integer generate() {
        return generator.nextInt(range) + minimumValue;
    }
}
